import { pubRequire } from '@utils/public'
const baseUrl = '/content/labels'
// 获取配置标签列表
export function getConTagsList(obj, callBack, errBack) {
  return pubRequire('get', `${baseUrl}`, obj, callBack, errBack)
}
//条件查询标签分类
export function getClasses(obj, callBack, errBack) {
  return pubRequire('get', `${baseUrl}/options`, obj, callBack, errBack)
}
//新增配置标签
export function postAddLable(obj, callBack, errBack) {
  return pubRequire('post', `${baseUrl}`, obj, callBack, errBack)
}
//编辑配置标签
export function editLable(obj, labelId, callBack, errBack) {
  return pubRequire('put', `${baseUrl}/${labelId}`, obj, callBack, errBack)
}
//删除配置标签
export function delLable(categorieId, callBack, errBack) {
  return pubRequire(
    'delete',
    `${baseUrl}/${categorieId}`,
    '',
    callBack,
    errBack
  )
}
//根据标签id查询内容数
export function getContNum(labelId, callBack, errBack) {
  return pubRequire(
    'get',
    `${baseUrl}/${labelId}/content-count`,
    '',
    callBack,
    errBack
  )
}
//标签推荐
export function putTagsugge(labelId, callBack, errBack) {
  return pubRequire(
    'put',
    `${baseUrl}/${labelId}/recommend`,
    '',
    callBack,
    errBack
  )
}
//校验标签名称是否重复
export function checkName(obj, callBack, errBack) {
  return pubRequire('get', `${baseUrl}/verifications`, obj, callBack, errBack)
}
//标签合并
export function mergeLable(sourceId, targetId, callBack, errBack) {
  return pubRequire(
    'put',
    `${baseUrl}/${sourceId}/merge/${targetId}`,
    '',
    callBack,
    errBack
  )
}
